#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
ll n, k;
ll a[N], f[N];
int main()
{
	cin >> n >> k;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
		f[i] = f[i - 1] + a[i];//前缀和 
	}
	sort(a + 1, a + 1 + n);

	ll l = 1, r = n;
	while (l < r)
	{
		ll mid = l+(r-l)/2;
		if (f[mid] + k <= a[mid] * mid)
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
	}
	cout << (f[l] + k) / l;

	return 0;
}
